﻿using System.ComponentModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace Devonline.Identity.Admin.Controllers;

/// <summary>
/// 基础数据管理
/// </summary>    
[ApiController]
[Route("api/[controller]")]
[Description("基础数据管理")]
[Authorize(Roles = GROUP_MAINTAINERS)]
[AccessAuthorize(Code = "AS0XParameter", Name = "基础数据管理", ResourceType = ResourceType.Service)]
public class ParametersController(ILogger<ParametersController> logger, IDataService<Parameter> dataService) : IdentityDataModelServiceController<Parameter, ParameterViewModel>(logger, dataService)
{
    [HttpGet]
    [DisplayName("查询")]
    [AccessAuthorize(Code = "AS0XParameterIGet")]
    public override async Task<IActionResult> GetAsync() => Ok(await Request.GetPagedResultAsync(_dataService.GetQueryable().Include(x => x.Parent)));
}